<?php
set_time_limit(0);
$root=preg_replace('/cron$/', '', dirname(__FILE__));

require_once($root."inc.config.php");

require_once($root."functions/common/common.php");

require_once($root."functions/general_function.php");

require_once($root."functions/downline/downline_function.php");

require_once($root."functions/comm/comm_function.php");

require_once($root."initialize.php");

if(($db_msg=cron_initialize()) !== true){

	$errmsg="Error starting rebuild tree";

	$a_sub="Error starting rebuild tree";

	$a_msg="<p>Dear admin,</p>$errmsg";

	//email_admin($a_sub, $a_msg, 'e');

}else{

	$db=$vars["db"];
	$username="slg2";
	for($i=3;$i<=100;$i++){
		$t = @mysql_num_rows($r=mysql_query("select id from gg_users where username='".$username."'"));
		
		if($t<=0)
		{
			print_r("error: ".$i);
			exit;
		}
		
		$user = mysql_fetch_assoc($r);
		
		$name = "SLG";
		$username = "slg".$i;
		$password = "stockist";
		$enc_password = "34b8f736d9c412ba96138842d3b5a115:tw67hry4cz5lhdno520pyegmdjuetnr";
		$ref = $user['id'];
		$cid = '1';
		$rank_a = '0.0';
		$is_stockist = 'y';
		$stockist_assign_date = date('Y-m-d');
		$matrix_upline = $user['id'];
		$matrix_position = '1';
		$email = "limsalim".$i."@gmail.com";
		$ic = '123456';
		$address = '-';
		$city = '-';
		$zip = '-';
		$state = '-';
		$country = 'MY';
		$mobileno = '0102646496';
		$dob = '1968-01-01';
		$gender = 'm';
		$acc_type = 'p';
		$remark = 'no incentive for mobile';
		$status = 'normal';
		$activated = 'n';
		$cdate = date('Y-m-d H:i:s');
		
		$sql = "insert into gg_users (name,username,password,enc_password,ewallet_password,ewallet_enc_password,epoint_password,epoint_enc_password,ref,cid,rank_a,is_stockist,stockist_assign_date,matrix_upline,matrix_position,email,ic,address,city,zip,state,country,mobileno,dob,gender,acc_type,remark,status,activated,cdate) values ('".$name."','".$username."','".$password."','".$enc_password."','".$password."','".$enc_password."','".$password."','".$enc_password."','".$ref."','".$cid."','".$rank_a."','".$is_stockist."','".$stockist_assign_date."','".$matrix_upline."','".$matrix_position."','".$email."','".$ic."','".$address."','".$city."','".$zip."','".$state."','".$country."','".$mobileno."','".$dob."','".$gender."','".$acc_type."','".$remark."','".$status."','".$activated."','".$cdate."')";
		//print_r($sql);exit;
		mysql_query($sql);
	}
	
	print_r('finish');
	exit;
}
	
?>